<template>
	<div class="iframe-linkType">
		<iframe ref="myIframe" :src="url" width="100%" height="100%" class="linkType-iframe"></iframe>
	</div>
</template>

<script>
	export default {
		data () {
			return {
				url:this.$route.query.url+'&token='+sessionStorage.getItem('plus_token')
			}
		}
		,mounted:function () {
			let self = this;
			window.addEventListener('message',function(rs){ 
		        console.log(rs.data);
		        if(rs.data.type == 'login') {
		        	self.$router.push('/login')
		        }else if (rs.data.type == 'home') {
		        	self.$router.push('/find')
		        }else if (rs.data.type == 'goDetail'){
		        	self.$router.push('/goods?id='+rs.data.goodId);
		        }
			})
		}
		,created: function () {
			 var iframe = this.$refs.myIframe;
			 console.log(iframe)
		}

	}
</script>

<style lang="less" rel="stylesheet/less">
	.iframe-linkType{
		width: 7.5rem;
		height: 100%;
		.linkType-iframe{
			border: none;
		}
	}
</style>